#include "pool_head.h"

int init_pool(thread_t *status, int num){
    status->num = num; //指定线程数量

    status->exit_flag = 0; //表示线程正常

    memset(&status->que,0,sizeof(status->que)); //初始化任务队列

    //初始化互斥锁和条件变量
    pthread_mutex_init(&status->lock,NULL);
    pthread_cond_init(&status->cond,NULL);

    status->list = (pthread_t*)calloc(num,sizeof(pthread_t));
    for(int i = 0; i < num; ++i){
        pthread_create(&status->list[i],NULL,thread_handler,status);
    }
    return 0;
}